function HighCamPostWrapper() {
    this.payload = {};
    this.location = '/imageservice_agent';
    var payload_str = '';

    // $.ajaxSettings.async = false;
    // $.getJSON(document.location.origin + "/static/post_car_plate.json", function (result) {
    //     payload_str = result;
    // });
    // $.ajaxSettings.async = true;
    // console.log('HighCamPostWrapper inited');
    // var payload_str = JSON.stringify(payload_str);
    // this.do_post({'payload': payload_str})
}

HighCamPostWrapper.prototype = {

    do_post: function (payload) {
        console.log('high cam posting');
        console.log(payload);
        $.ajax({
            type: "POST",
            url: this.location,
            dataType: "json",
            data: payload,
            success: function (data) {
                console.log('post success');
                console.log(data);

                if (data['trace_synthesis_img']) {
                    base64_trace_str = data['trace_synthesis_img'];
                    g_base64_im.canvas_draw_base64("canvas", base64_trace_str, 0, 0,
                        width = g_cor_post_wrapper.width, height = g_cor_post_wrapper.height);

                    var plate_str = data['plate_info']['number'];
                    document.getElementById("trace_result_from_jsonfile").innerHTML = "plate:" + plate_str;
                } else {
                    g_base64_im.canvas_clear("canvas", 0, 0,
                        width = g_cor_post_wrapper.width, height = g_cor_post_wrapper.height);
                }
            },
            error: function (e) {
                console.log("post error:");
                console.log(e)
            }
        });
    }
};